import 'dart:convert';
import 'package:meta/meta.dart';

class Mession {
  final int id;
  final String m_name;
  final int m_type;
  final String m_type_name;
  final String m_slogen;
  final String m_icon;
  final int m_point;

  Mession(
      {
        @required this.id,
        @required this.m_name,
        @required this.m_type,
        @required this.m_type_name,
        @required this.m_slogen,
        @required this.m_icon,
        @required this.m_point
      });

  static List<Mession> fromJson(String json){
    List<Mession> _messions = [];
    JsonDecoder decoder = new JsonDecoder();
    var mapData = decoder.convert(json)['data']['messionList'];
    mapData.forEach((obj){
      Mession mession = new Mession(
          id: obj['id'],
          m_name: obj['m_name'],
          m_type: obj['m_type'],
          m_type_name: obj['m_type_name'],
          m_slogen: obj['m_slogen'],
          m_icon: obj['m_icon'],
          m_point: obj['m_point']
      );
      _messions.add(mession);
    });
    return _messions;
  }
//  factory Mession.fromJson(Map<String, dynamic> json) {
//    return Mession(
//      m_name: json['m_name'],
//      m_type: json['m_type'],
//      m_type_name: json['m_type_name'],
//      m_slogen: json['m_slogen'],
//      m_icon: json['m_icon'],
//      m_point: json['m_point'],
//    );
//  }
}